/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.controlstudent.android.app;

import android.app.Activity;
import android.app.ListActivity;
import android.os.Bundle;

import com.controlstudent.android.app.entidades.Citacion;
import com.controlstudent.android.app.util.URLUtil;
import com.google.gson.reflect.TypeToken;
import com.nlcode.util.gsonxml.GsonXmlUtil;
import com.nlcode.util.gsonxml.ListContainer;
import com.stanfy.jsonxml.GsonXml;
import java.util.List;

/**
 *
 * @author Batkev
 */
public class Citaciones extends ListActivity {
private ListaCitacionesAdapter adapter;
    /**
     * Called when the activity is first created.
     */
    @Override
    public void onCreate(Bundle icicle) {
        super.onCreate(icicle);
      setContentView(R.layout.citaciones);
        // ToDo add your GUI initialization code here      
          String url = "http://192.168.1.33:8084/SCWebServices/webresources/studentcontrolwsport/devolvercitaciones/?id=1";
        String xml = URLUtil.getContent(url);

        GsonXml gxml = GsonXmlUtil.getGsonXml();
        List<Citacion> lstCitaciones = gxml.<ListContainer>fromXml(xml,new TypeToken<ListContainer<Citacion>>(){}.getType()).getList();;

        adapter = new ListaCitacionesAdapter(this, lstCitaciones);
        setListAdapter(adapter);   
    }
    
}
